package org.sixdog.mcsit.utils;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

public class HttpResult {
    //成功
    public static final String SUCCESS_CODE = "200";
    //错误请求(参数有误等)
    public static final String WRONG_REQUEST = "400";
    //未授权
    public static final String UNAUTHORIZED = "401";
    //错误
    public static final String ERROR_CODE = "500";



    public static Map<String,Object> build(String code,Object data,String msg){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("code", code);
        resultMap.put("data", data);
        resultMap.put("msg", msg);
        return resultMap;
    }

    public static Map<String,Object> build(String code,Object data){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("code", code);
        resultMap.put("data", data);
        return resultMap;
    }

    public static Map<String,Object> build(String code,String msg){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("code", code);
        resultMap.put("msg", msg);
        return resultMap;
    }

    public static Map<String,Object> build(Object data){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("code", "200");
        resultMap.put("data", data);
        return resultMap;
    }



}
